{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "efb41c9e450b5a29",
   "metadata": {},
   "source": [
    "# Cognee GraphRAG Simple Example"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "982b897a29a26f7d",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "zsh:1: command not found: pip\n"
     ]
    }
   ],
   "source": "!pip install cognee==0.2.0"
  },
  {
   "cell_type": "markdown",
   "id": "f51e92e9fdcf77b7",
   "metadata": {},
   "source": [
    " By default cognee uses OpenAI's gpt-4o-mini LLM model.\n",
    "\n",
    " Provide your OpenAI LLM API KEY in the step bellow. Here's a guide on how to get your [OpenAI API key](https://help.openai.com/en/articles/4936850-where-do-i-find-my-openai-api-key)."
   ]
  },
  {
   "cell_type": "code",
   "id": "initial_id",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-06-30T12:08:22.650719Z",
     "start_time": "2025-06-30T12:08:22.646047Z"
    }
   },
   "source": [
    "import os\n",
    "\n",
    "os.environ[\"LLM_API_KEY\"] = \"\""
   ],
   "outputs": [],
   "execution_count": 1
  },
  {
   "cell_type": "markdown",
   "id": "f1fec64bc573bb",
   "metadata": {},
   "source": [
    "In this step we'll get the location of the file to store and process."
   ]
  },
  {
   "cell_type": "code",
   "id": "5805c346f03d8070",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-06-30T12:08:23.557926Z",
     "start_time": "2025-06-30T12:08:23.555854Z"
    }
   },
   "source": [
    "current_directory = os.getcwd()\n",
    "file_path = os.path.join(current_directory, \"data\", \"alice_in_wonderland.txt\")"
   ],
   "outputs": [],
   "execution_count": 2
  },
  {
   "cell_type": "markdown",
   "id": "2826a80ca1ad0438",
   "metadata": {},
   "source": [
    "Give the file location to cognee to save it and process its contents"
   ]
  },
  {
   "cell_type": "code",
   "id": "875763366723ee48",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-06-30T12:08:34.629436Z",
     "start_time": "2025-06-30T12:08:24.800887Z"
    }
   },
   "source": [
    "import cognee\n",
    "await cognee.add(file_path)\n",
    "await cognee.cognify()"
   ],
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/Users/vasilije/cognee/.venv/lib/python3.11/site-packages/tqdm/auto.py:21: TqdmWarning: IProgress not found. Please update jupyter and ipywidgets. See https://ipywidgets.readthedocs.io/en/stable/user_install.html\n",
      "  from .autonotebook import tqdm as notebook_tqdm\n"
     ]
    },
    {
     "ename": "OperationalError",
     "evalue": "(sqlite3.OperationalError) database is locked\n[SQL: \nCREATE TABLE data (\n\tid UUID NOT NULL, \n\tname VARCHAR, \n\textension VARCHAR, \n\tmime_type VARCHAR, \n\traw_data_location VARCHAR, \n\towner_id UUID, \n\tcontent_hash VARCHAR, \n\texternal_metadata JSON, \n\tnode_set JSON, \n\ttoken_count INTEGER, \n\tcreated_at DATETIME, \n\tupdated_at DATETIME, \n\tPRIMARY KEY (id)\n)\n\n]\n(Background on this error at: https://sqlalche.me/e/20/e3q8)",
     "output_type": "error",
     "traceback": [
      "\u001B[31m---------------------------------------------------------------------------\u001B[39m",
      "\u001B[31mOperationalError\u001B[39m                          Traceback (most recent call last)",
      "\u001B[36mFile \u001B[39m\u001B[32m~/cognee/.venv/lib/python3.11/site-packages/sqlalchemy/engine/base.py:1964\u001B[39m, in \u001B[36mConnection._exec_single_context\u001B[39m\u001B[34m(self, dialect, context, statement, parameters)\u001B[39m\n\u001B[32m   1963\u001B[39m     \u001B[38;5;28;01mif\u001B[39;00m \u001B[38;5;129;01mnot\u001B[39;00m evt_handled:\n\u001B[32m-> \u001B[39m\u001B[32m1964\u001B[39m         \u001B[38;5;28;43mself\u001B[39;49m\u001B[43m.\u001B[49m\u001B[43mdialect\u001B[49m\u001B[43m.\u001B[49m\u001B[43mdo_execute\u001B[49m\u001B[43m(\u001B[49m\n\u001B[32m   1965\u001B[39m \u001B[43m            \u001B[49m\u001B[43mcursor\u001B[49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[43mstr_statement\u001B[49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[43meffective_parameters\u001B[49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[43mcontext\u001B[49m\n\u001B[32m   1966\u001B[39m \u001B[43m        \u001B[49m\u001B[43m)\u001B[49m\n\u001B[32m   1968\u001B[39m \u001B[38;5;28;01mif\u001B[39;00m \u001B[38;5;28mself\u001B[39m._has_events \u001B[38;5;129;01mor\u001B[39;00m \u001B[38;5;28mself\u001B[39m.engine._has_events:\n",
      "\u001B[36mFile \u001B[39m\u001B[32m~/cognee/.venv/lib/python3.11/site-packages/sqlalchemy/engine/default.py:942\u001B[39m, in \u001B[36mDefaultDialect.do_execute\u001B[39m\u001B[34m(self, cursor, statement, parameters, context)\u001B[39m\n\u001B[32m    941\u001B[39m \u001B[38;5;28;01mdef\u001B[39;00m\u001B[38;5;250m \u001B[39m\u001B[34mdo_execute\u001B[39m(\u001B[38;5;28mself\u001B[39m, cursor, statement, parameters, context=\u001B[38;5;28;01mNone\u001B[39;00m):\n\u001B[32m--> \u001B[39m\u001B[32m942\u001B[39m     \u001B[43mcursor\u001B[49m\u001B[43m.\u001B[49m\u001B[43mexecute\u001B[49m\u001B[43m(\u001B[49m\u001B[43mstatement\u001B[49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[43mparameters\u001B[49m\u001B[43m)\u001B[49m\n",
      "\u001B[36mFile \u001B[39m\u001B[32m~/cognee/.venv/lib/python3.11/site-packages/sqlalchemy/dialects/sqlite/aiosqlite.py:172\u001B[39m, in \u001B[36mAsyncAdapt_aiosqlite_cursor.execute\u001B[39m\u001B[34m(self, operation, parameters)\u001B[39m\n\u001B[32m    171\u001B[39m \u001B[38;5;28;01mexcept\u001B[39;00m \u001B[38;5;167;01mException\u001B[39;00m \u001B[38;5;28;01mas\u001B[39;00m error:\n\u001B[32m--> \u001B[39m\u001B[32m172\u001B[39m     \u001B[38;5;28;43mself\u001B[39;49m\u001B[43m.\u001B[49m\u001B[43m_adapt_connection\u001B[49m\u001B[43m.\u001B[49m\u001B[43m_handle_exception\u001B[49m\u001B[43m(\u001B[49m\u001B[43merror\u001B[49m\u001B[43m)\u001B[49m\n",
      "\u001B[36mFile \u001B[39m\u001B[32m~/cognee/.venv/lib/python3.11/site-packages/sqlalchemy/dialects/sqlite/aiosqlite.py:323\u001B[39m, in \u001B[36mAsyncAdapt_aiosqlite_connection._handle_exception\u001B[39m\u001B[34m(self, error)\u001B[39m\n\u001B[32m    322\u001B[39m \u001B[38;5;28;01melse\u001B[39;00m:\n\u001B[32m--> \u001B[39m\u001B[32m323\u001B[39m     \u001B[38;5;28;01mraise\u001B[39;00m error\n",
      "\u001B[36mFile \u001B[39m\u001B[32m~/cognee/.venv/lib/python3.11/site-packages/sqlalchemy/dialects/sqlite/aiosqlite.py:154\u001B[39m, in \u001B[36mAsyncAdapt_aiosqlite_cursor.execute\u001B[39m\u001B[34m(self, operation, parameters)\u001B[39m\n\u001B[32m    153\u001B[39m \u001B[38;5;28;01melse\u001B[39;00m:\n\u001B[32m--> \u001B[39m\u001B[32m154\u001B[39m     \u001B[38;5;28;43mself\u001B[39;49m\u001B[43m.\u001B[49m\u001B[43mawait_\u001B[49m\u001B[43m(\u001B[49m\u001B[43m_cursor\u001B[49m\u001B[43m.\u001B[49m\u001B[43mexecute\u001B[49m\u001B[43m(\u001B[49m\u001B[43moperation\u001B[49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[43mparameters\u001B[49m\u001B[43m)\u001B[49m\u001B[43m)\u001B[49m\n\u001B[32m    156\u001B[39m \u001B[38;5;28;01mif\u001B[39;00m _cursor.description:\n",
      "\u001B[36mFile \u001B[39m\u001B[32m~/cognee/.venv/lib/python3.11/site-packages/sqlalchemy/util/_concurrency_py3k.py:132\u001B[39m, in \u001B[36mawait_only\u001B[39m\u001B[34m(awaitable)\u001B[39m\n\u001B[32m    128\u001B[39m \u001B[38;5;66;03m# returns the control to the driver greenlet passing it\u001B[39;00m\n\u001B[32m    129\u001B[39m \u001B[38;5;66;03m# a coroutine to run. Once the awaitable is done, the driver greenlet\u001B[39;00m\n\u001B[32m    130\u001B[39m \u001B[38;5;66;03m# switches back to this greenlet with the result of awaitable that is\u001B[39;00m\n\u001B[32m    131\u001B[39m \u001B[38;5;66;03m# then returned to the caller (or raised as error)\u001B[39;00m\n\u001B[32m--> \u001B[39m\u001B[32m132\u001B[39m \u001B[38;5;28;01mreturn\u001B[39;00m \u001B[43mcurrent\u001B[49m\u001B[43m.\u001B[49m\u001B[43mparent\u001B[49m\u001B[43m.\u001B[49m\u001B[43mswitch\u001B[49m\u001B[43m(\u001B[49m\u001B[43mawaitable\u001B[49m\u001B[43m)\u001B[49m\n",
      "\u001B[36mFile \u001B[39m\u001B[32m~/cognee/.venv/lib/python3.11/site-packages/sqlalchemy/util/_concurrency_py3k.py:196\u001B[39m, in \u001B[36mgreenlet_spawn\u001B[39m\u001B[34m(fn, _require_await, *args, **kwargs)\u001B[39m\n\u001B[32m    193\u001B[39m \u001B[38;5;28;01mtry\u001B[39;00m:\n\u001B[32m    194\u001B[39m     \u001B[38;5;66;03m# wait for a coroutine from await_only and then return its\u001B[39;00m\n\u001B[32m    195\u001B[39m     \u001B[38;5;66;03m# result back to it.\u001B[39;00m\n\u001B[32m--> \u001B[39m\u001B[32m196\u001B[39m     value = \u001B[38;5;28;01mawait\u001B[39;00m result\n\u001B[32m    197\u001B[39m \u001B[38;5;28;01mexcept\u001B[39;00m \u001B[38;5;167;01mBaseException\u001B[39;00m:\n\u001B[32m    198\u001B[39m     \u001B[38;5;66;03m# this allows an exception to be raised within\u001B[39;00m\n\u001B[32m    199\u001B[39m     \u001B[38;5;66;03m# the moderated greenlet so that it can continue\u001B[39;00m\n\u001B[32m    200\u001B[39m     \u001B[38;5;66;03m# its expected flow.\u001B[39;00m\n",
      "\u001B[36mFile \u001B[39m\u001B[32m~/cognee/.venv/lib/python3.11/site-packages/aiosqlite/cursor.py:48\u001B[39m, in \u001B[36mCursor.execute\u001B[39m\u001B[34m(self, sql, parameters)\u001B[39m\n\u001B[32m     47\u001B[39m     parameters = []\n\u001B[32m---> \u001B[39m\u001B[32m48\u001B[39m \u001B[38;5;28;01mawait\u001B[39;00m \u001B[38;5;28mself\u001B[39m._execute(\u001B[38;5;28mself\u001B[39m._cursor.execute, sql, parameters)\n\u001B[32m     49\u001B[39m \u001B[38;5;28;01mreturn\u001B[39;00m \u001B[38;5;28mself\u001B[39m\n",
      "\u001B[36mFile \u001B[39m\u001B[32m~/cognee/.venv/lib/python3.11/site-packages/aiosqlite/cursor.py:40\u001B[39m, in \u001B[36mCursor._execute\u001B[39m\u001B[34m(self, fn, *args, **kwargs)\u001B[39m\n\u001B[32m     39\u001B[39m \u001B[38;5;250m\u001B[39m\u001B[33;03m\"\"\"Execute the given function on the shared connection's thread.\"\"\"\u001B[39;00m\n\u001B[32m---> \u001B[39m\u001B[32m40\u001B[39m \u001B[38;5;28;01mreturn\u001B[39;00m \u001B[38;5;28;01mawait\u001B[39;00m \u001B[38;5;28mself\u001B[39m._conn._execute(fn, *args, **kwargs)\n",
      "\u001B[36mFile \u001B[39m\u001B[32m~/cognee/.venv/lib/python3.11/site-packages/aiosqlite/core.py:132\u001B[39m, in \u001B[36mConnection._execute\u001B[39m\u001B[34m(self, fn, *args, **kwargs)\u001B[39m\n\u001B[32m    130\u001B[39m \u001B[38;5;28mself\u001B[39m._tx.put_nowait((future, function))\n\u001B[32m--> \u001B[39m\u001B[32m132\u001B[39m \u001B[38;5;28;01mreturn\u001B[39;00m \u001B[38;5;28;01mawait\u001B[39;00m future\n",
      "\u001B[36mFile \u001B[39m\u001B[32m~/cognee/.venv/lib/python3.11/site-packages/aiosqlite/core.py:115\u001B[39m, in \u001B[36mConnection.run\u001B[39m\u001B[34m(self)\u001B[39m\n\u001B[32m    114\u001B[39m LOG.debug(\u001B[33m\"\u001B[39m\u001B[33mexecuting \u001B[39m\u001B[38;5;132;01m%s\u001B[39;00m\u001B[33m\"\u001B[39m, function)\n\u001B[32m--> \u001B[39m\u001B[32m115\u001B[39m result = \u001B[43mfunction\u001B[49m\u001B[43m(\u001B[49m\u001B[43m)\u001B[49m\n\u001B[32m    116\u001B[39m LOG.debug(\u001B[33m\"\u001B[39m\u001B[33moperation \u001B[39m\u001B[38;5;132;01m%s\u001B[39;00m\u001B[33m completed\u001B[39m\u001B[33m\"\u001B[39m, function)\n",
      "\u001B[31mOperationalError\u001B[39m: database is locked",
      "\nThe above exception was the direct cause of the following exception:\n",
      "\u001B[31mOperationalError\u001B[39m                          Traceback (most recent call last)",
      "\u001B[36mCell\u001B[39m\u001B[36m \u001B[39m\u001B[32mIn[3]\u001B[39m\u001B[32m, line 2\u001B[39m\n\u001B[32m      1\u001B[39m \u001B[38;5;28;01mimport\u001B[39;00m\u001B[38;5;250m \u001B[39m\u001B[34;01mcognee\u001B[39;00m\n\u001B[32m----> \u001B[39m\u001B[32m2\u001B[39m \u001B[38;5;28;01mawait\u001B[39;00m cognee.add(file_path)\n\u001B[32m      3\u001B[39m \u001B[38;5;28;01mawait\u001B[39;00m cognee.cognify()\n",
      "\u001B[36mFile \u001B[39m\u001B[32m~/Projects/release_test/cognee/cognee/api/v1/add/add.py:26\u001B[39m, in \u001B[36madd\u001B[39m\u001B[34m(data, dataset_name, user, node_set, vector_db_config, graph_db_config, dataset_id)\u001B[39m\n\u001B[32m     19\u001B[39m tasks = [\n\u001B[32m     20\u001B[39m     Task(resolve_data_directories),\n\u001B[32m     21\u001B[39m     Task(ingest_data, dataset_name, user, node_set, dataset_id),\n\u001B[32m     22\u001B[39m ]\n\u001B[32m     24\u001B[39m pipeline_run_info = \u001B[38;5;28;01mNone\u001B[39;00m\n\u001B[32m---> \u001B[39m\u001B[32m26\u001B[39m \u001B[38;5;28;01masync\u001B[39;00m \u001B[38;5;28;01mfor\u001B[39;00m run_info \u001B[38;5;129;01min\u001B[39;00m cognee_pipeline(\n\u001B[32m     27\u001B[39m     tasks=tasks,\n\u001B[32m     28\u001B[39m     datasets=dataset_id \u001B[38;5;28;01mif\u001B[39;00m dataset_id \u001B[38;5;28;01melse\u001B[39;00m dataset_name,\n\u001B[32m     29\u001B[39m     data=data,\n\u001B[32m     30\u001B[39m     user=user,\n\u001B[32m     31\u001B[39m     pipeline_name=\u001B[33m\"\u001B[39m\u001B[33madd_pipeline\u001B[39m\u001B[33m\"\u001B[39m,\n\u001B[32m     32\u001B[39m     vector_db_config=vector_db_config,\n\u001B[32m     33\u001B[39m     graph_db_config=graph_db_config,\n\u001B[32m     34\u001B[39m ):\n\u001B[32m     35\u001B[39m     pipeline_run_info = run_info\n\u001B[32m     37\u001B[39m \u001B[38;5;28;01mreturn\u001B[39;00m pipeline_run_info\n",
      "\u001B[36mFile \u001B[39m\u001B[32m~/Projects/release_test/cognee/cognee/modules/pipelines/operations/pipeline.py:63\u001B[39m, in \u001B[36mcognee_pipeline\u001B[39m\u001B[34m(tasks, data, datasets, user, pipeline_name, vector_db_config, graph_db_config)\u001B[39m\n\u001B[32m     60\u001B[39m     context_graph_db_config.set(graph_db_config)\n\u001B[32m     62\u001B[39m \u001B[38;5;66;03m# Create tables for databases\u001B[39;00m\n\u001B[32m---> \u001B[39m\u001B[32m63\u001B[39m \u001B[38;5;28;01mawait\u001B[39;00m create_relational_db_and_tables()\n\u001B[32m     64\u001B[39m \u001B[38;5;28;01mawait\u001B[39;00m create_pgvector_db_and_tables()\n\u001B[32m     66\u001B[39m \u001B[38;5;66;03m# Initialize first_run attribute if it doesn't exist\u001B[39;00m\n",
      "\u001B[36mFile \u001B[39m\u001B[32m~/Projects/release_test/cognee/cognee/infrastructure/databases/relational/create_db_and_tables.py:13\u001B[39m, in \u001B[36mcreate_db_and_tables\u001B[39m\u001B[34m()\u001B[39m\n\u001B[32m      5\u001B[39m \u001B[38;5;250m\u001B[39m\u001B[33;03m\"\"\"\u001B[39;00m\n\u001B[32m      6\u001B[39m \u001B[33;03mCreate a database and its tables.\u001B[39;00m\n\u001B[32m      7\u001B[39m \n\u001B[32m      8\u001B[39m \u001B[33;03mThis asynchronous function retrieves the relational engine and calls its method to\u001B[39;00m\n\u001B[32m      9\u001B[39m \u001B[33;03mcreate a database.\u001B[39;00m\n\u001B[32m     10\u001B[39m \u001B[33;03m\"\"\"\u001B[39;00m\n\u001B[32m     11\u001B[39m relational_engine = get_relational_engine()\n\u001B[32m---> \u001B[39m\u001B[32m13\u001B[39m \u001B[38;5;28;01mawait\u001B[39;00m relational_engine.create_database()\n",
      "\u001B[36mFile \u001B[39m\u001B[32m~/.pyenv/versions/3.11.0/lib/python3.11/contextlib.py:222\u001B[39m, in \u001B[36m_AsyncGeneratorContextManager.__aexit__\u001B[39m\u001B[34m(self, typ, value, traceback)\u001B[39m\n\u001B[32m    220\u001B[39m     value = typ()\n\u001B[32m    221\u001B[39m \u001B[38;5;28;01mtry\u001B[39;00m:\n\u001B[32m--> \u001B[39m\u001B[32m222\u001B[39m     \u001B[38;5;28;01mawait\u001B[39;00m \u001B[38;5;28mself\u001B[39m.gen.athrow(typ, value, traceback)\n\u001B[32m    223\u001B[39m \u001B[38;5;28;01mexcept\u001B[39;00m \u001B[38;5;167;01mStopAsyncIteration\u001B[39;00m \u001B[38;5;28;01mas\u001B[39;00m exc:\n\u001B[32m    224\u001B[39m     \u001B[38;5;66;03m# Suppress StopIteration *unless* it's the same exception that\u001B[39;00m\n\u001B[32m    225\u001B[39m     \u001B[38;5;66;03m# was passed to throw().  This prevents a StopIteration\u001B[39;00m\n\u001B[32m    226\u001B[39m     \u001B[38;5;66;03m# raised inside the \"with\" statement from being suppressed.\u001B[39;00m\n\u001B[32m    227\u001B[39m     \u001B[38;5;28;01mreturn\u001B[39;00m exc \u001B[38;5;129;01mis\u001B[39;00m \u001B[38;5;129;01mnot\u001B[39;00m value\n",
      "\u001B[36mFile \u001B[39m\u001B[32m~/cognee/.venv/lib/python3.11/site-packages/sqlalchemy/ext/asyncio/engine.py:1066\u001B[39m, in \u001B[36mAsyncEngine.begin\u001B[39m\u001B[34m(self)\u001B[39m\n\u001B[32m   1064\u001B[39m \u001B[38;5;28;01masync\u001B[39;00m \u001B[38;5;28;01mwith\u001B[39;00m conn:\n\u001B[32m   1065\u001B[39m     \u001B[38;5;28;01masync\u001B[39;00m \u001B[38;5;28;01mwith\u001B[39;00m conn.begin():\n\u001B[32m-> \u001B[39m\u001B[32m1066\u001B[39m         \u001B[38;5;28;01myield\u001B[39;00m conn\n",
      "\u001B[36mFile \u001B[39m\u001B[32m~/Projects/release_test/cognee/cognee/infrastructure/databases/relational/sqlalchemy/SqlAlchemyAdapter.py:445\u001B[39m, in \u001B[36mSQLAlchemyAdapter.create_database\u001B[39m\u001B[34m(self)\u001B[39m\n\u001B[32m    443\u001B[39m \u001B[38;5;28;01masync\u001B[39;00m \u001B[38;5;28;01mwith\u001B[39;00m \u001B[38;5;28mself\u001B[39m.engine.begin() \u001B[38;5;28;01mas\u001B[39;00m connection:\n\u001B[32m    444\u001B[39m     \u001B[38;5;28;01mif\u001B[39;00m \u001B[38;5;28mlen\u001B[39m(Base.metadata.tables.keys()) > \u001B[32m0\u001B[39m:\n\u001B[32m--> \u001B[39m\u001B[32m445\u001B[39m         \u001B[38;5;28;01mawait\u001B[39;00m connection.run_sync(Base.metadata.create_all)\n",
      "\u001B[36mFile \u001B[39m\u001B[32m~/cognee/.venv/lib/python3.11/site-packages/sqlalchemy/ext/asyncio/engine.py:887\u001B[39m, in \u001B[36mAsyncConnection.run_sync\u001B[39m\u001B[34m(self, fn, *arg, **kw)\u001B[39m\n\u001B[32m    819\u001B[39m \u001B[38;5;28;01masync\u001B[39;00m \u001B[38;5;28;01mdef\u001B[39;00m\u001B[38;5;250m \u001B[39m\u001B[34mrun_sync\u001B[39m(\n\u001B[32m    820\u001B[39m     \u001B[38;5;28mself\u001B[39m,\n\u001B[32m    821\u001B[39m     fn: Callable[Concatenate[Connection, _P], _T],\n\u001B[32m    822\u001B[39m     *arg: _P.args,\n\u001B[32m    823\u001B[39m     **kw: _P.kwargs,\n\u001B[32m    824\u001B[39m ) -> _T:\n\u001B[32m    825\u001B[39m \u001B[38;5;250m    \u001B[39m\u001B[33;03m'''Invoke the given synchronous (i.e. not async) callable,\u001B[39;00m\n\u001B[32m    826\u001B[39m \u001B[33;03m    passing a synchronous-style :class:`_engine.Connection` as the first\u001B[39;00m\n\u001B[32m    827\u001B[39m \u001B[33;03m    argument.\u001B[39;00m\n\u001B[32m   (...)\u001B[39m\u001B[32m    884\u001B[39m \n\u001B[32m    885\u001B[39m \u001B[33;03m    '''\u001B[39;00m  \u001B[38;5;66;03m# noqa: E501\u001B[39;00m\n\u001B[32m--> \u001B[39m\u001B[32m887\u001B[39m     \u001B[38;5;28;01mreturn\u001B[39;00m \u001B[38;5;28;01mawait\u001B[39;00m greenlet_spawn(\n\u001B[32m    888\u001B[39m         fn, \u001B[38;5;28mself\u001B[39m._proxied, *arg, _require_await=\u001B[38;5;28;01mFalse\u001B[39;00m, **kw\n\u001B[32m    889\u001B[39m     )\n",
      "\u001B[36mFile \u001B[39m\u001B[32m~/cognee/.venv/lib/python3.11/site-packages/sqlalchemy/util/_concurrency_py3k.py:201\u001B[39m, in \u001B[36mgreenlet_spawn\u001B[39m\u001B[34m(fn, _require_await, *args, **kwargs)\u001B[39m\n\u001B[32m    196\u001B[39m     value = \u001B[38;5;28;01mawait\u001B[39;00m result\n\u001B[32m    197\u001B[39m \u001B[38;5;28;01mexcept\u001B[39;00m \u001B[38;5;167;01mBaseException\u001B[39;00m:\n\u001B[32m    198\u001B[39m     \u001B[38;5;66;03m# this allows an exception to be raised within\u001B[39;00m\n\u001B[32m    199\u001B[39m     \u001B[38;5;66;03m# the moderated greenlet so that it can continue\u001B[39;00m\n\u001B[32m    200\u001B[39m     \u001B[38;5;66;03m# its expected flow.\u001B[39;00m\n\u001B[32m--> \u001B[39m\u001B[32m201\u001B[39m     result = \u001B[43mcontext\u001B[49m\u001B[43m.\u001B[49m\u001B[43mthrow\u001B[49m\u001B[43m(\u001B[49m\u001B[43m*\u001B[49m\u001B[43msys\u001B[49m\u001B[43m.\u001B[49m\u001B[43mexc_info\u001B[49m\u001B[43m(\u001B[49m\u001B[43m)\u001B[49m\u001B[43m)\u001B[49m\n\u001B[32m    202\u001B[39m \u001B[38;5;28;01melse\u001B[39;00m:\n\u001B[32m    203\u001B[39m     result = context.switch(value)\n",
      "\u001B[36mFile \u001B[39m\u001B[32m~/cognee/.venv/lib/python3.11/site-packages/sqlalchemy/sql/schema.py:5907\u001B[39m, in \u001B[36mMetaData.create_all\u001B[39m\u001B[34m(self, bind, tables, checkfirst)\u001B[39m\n\u001B[32m   5883\u001B[39m \u001B[38;5;28;01mdef\u001B[39;00m\u001B[38;5;250m \u001B[39m\u001B[34mcreate_all\u001B[39m(\n\u001B[32m   5884\u001B[39m     \u001B[38;5;28mself\u001B[39m,\n\u001B[32m   5885\u001B[39m     bind: _CreateDropBind,\n\u001B[32m   5886\u001B[39m     tables: Optional[_typing_Sequence[Table]] = \u001B[38;5;28;01mNone\u001B[39;00m,\n\u001B[32m   5887\u001B[39m     checkfirst: \u001B[38;5;28mbool\u001B[39m = \u001B[38;5;28;01mTrue\u001B[39;00m,\n\u001B[32m   5888\u001B[39m ) -> \u001B[38;5;28;01mNone\u001B[39;00m:\n\u001B[32m   5889\u001B[39m \u001B[38;5;250m    \u001B[39m\u001B[33;03m\"\"\"Create all tables stored in this metadata.\u001B[39;00m\n\u001B[32m   5890\u001B[39m \n\u001B[32m   5891\u001B[39m \u001B[33;03m    Conditional by default, will not attempt to recreate tables already\u001B[39;00m\n\u001B[32m   (...)\u001B[39m\u001B[32m   5905\u001B[39m \n\u001B[32m   5906\u001B[39m \u001B[33;03m    \"\"\"\u001B[39;00m\n\u001B[32m-> \u001B[39m\u001B[32m5907\u001B[39m     \u001B[43mbind\u001B[49m\u001B[43m.\u001B[49m\u001B[43m_run_ddl_visitor\u001B[49m\u001B[43m(\u001B[49m\n\u001B[32m   5908\u001B[39m \u001B[43m        \u001B[49m\u001B[43mddl\u001B[49m\u001B[43m.\u001B[49m\u001B[43mSchemaGenerator\u001B[49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[38;5;28;43mself\u001B[39;49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[43mcheckfirst\u001B[49m\u001B[43m=\u001B[49m\u001B[43mcheckfirst\u001B[49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[43mtables\u001B[49m\u001B[43m=\u001B[49m\u001B[43mtables\u001B[49m\n\u001B[32m   5909\u001B[39m \u001B[43m    \u001B[49m\u001B[43m)\u001B[49m\n",
      "\u001B[36mFile \u001B[39m\u001B[32m~/cognee/.venv/lib/python3.11/site-packages/sqlalchemy/engine/base.py:2456\u001B[39m, in \u001B[36mConnection._run_ddl_visitor\u001B[39m\u001B[34m(self, visitorcallable, element, **kwargs)\u001B[39m\n\u001B[32m   2444\u001B[39m \u001B[38;5;28;01mdef\u001B[39;00m\u001B[38;5;250m \u001B[39m\u001B[34m_run_ddl_visitor\u001B[39m(\n\u001B[32m   2445\u001B[39m     \u001B[38;5;28mself\u001B[39m,\n\u001B[32m   2446\u001B[39m     visitorcallable: Type[Union[SchemaGenerator, SchemaDropper]],\n\u001B[32m   2447\u001B[39m     element: SchemaItem,\n\u001B[32m   2448\u001B[39m     **kwargs: Any,\n\u001B[32m   2449\u001B[39m ) -> \u001B[38;5;28;01mNone\u001B[39;00m:\n\u001B[32m   2450\u001B[39m \u001B[38;5;250m    \u001B[39m\u001B[33;03m\"\"\"run a DDL visitor.\u001B[39;00m\n\u001B[32m   2451\u001B[39m \n\u001B[32m   2452\u001B[39m \u001B[33;03m    This method is only here so that the MockConnection can change the\u001B[39;00m\n\u001B[32m   2453\u001B[39m \u001B[33;03m    options given to the visitor so that \"checkfirst\" is skipped.\u001B[39;00m\n\u001B[32m   2454\u001B[39m \n\u001B[32m   2455\u001B[39m \u001B[33;03m    \"\"\"\u001B[39;00m\n\u001B[32m-> \u001B[39m\u001B[32m2456\u001B[39m     \u001B[43mvisitorcallable\u001B[49m\u001B[43m(\u001B[49m\u001B[38;5;28;43mself\u001B[39;49m\u001B[43m.\u001B[49m\u001B[43mdialect\u001B[49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[38;5;28;43mself\u001B[39;49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[43m*\u001B[49m\u001B[43m*\u001B[49m\u001B[43mkwargs\u001B[49m\u001B[43m)\u001B[49m\u001B[43m.\u001B[49m\u001B[43mtraverse_single\u001B[49m\u001B[43m(\u001B[49m\u001B[43melement\u001B[49m\u001B[43m)\u001B[49m\n",
      "\u001B[36mFile \u001B[39m\u001B[32m~/cognee/.venv/lib/python3.11/site-packages/sqlalchemy/sql/visitors.py:664\u001B[39m, in \u001B[36mExternalTraversal.traverse_single\u001B[39m\u001B[34m(self, obj, **kw)\u001B[39m\n\u001B[32m    662\u001B[39m meth = \u001B[38;5;28mgetattr\u001B[39m(v, \u001B[33m\"\u001B[39m\u001B[33mvisit_\u001B[39m\u001B[38;5;132;01m%s\u001B[39;00m\u001B[33m\"\u001B[39m % obj.__visit_name__, \u001B[38;5;28;01mNone\u001B[39;00m)\n\u001B[32m    663\u001B[39m \u001B[38;5;28;01mif\u001B[39;00m meth:\n\u001B[32m--> \u001B[39m\u001B[32m664\u001B[39m     \u001B[38;5;28;01mreturn\u001B[39;00m \u001B[43mmeth\u001B[49m\u001B[43m(\u001B[49m\u001B[43mobj\u001B[49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[43m*\u001B[49m\u001B[43m*\u001B[49m\u001B[43mkw\u001B[49m\u001B[43m)\u001B[49m\n",
      "\u001B[36mFile \u001B[39m\u001B[32m~/cognee/.venv/lib/python3.11/site-packages/sqlalchemy/sql/ddl.py:978\u001B[39m, in \u001B[36mSchemaGenerator.visit_metadata\u001B[39m\u001B[34m(self, metadata)\u001B[39m\n\u001B[32m    976\u001B[39m \u001B[38;5;28;01mfor\u001B[39;00m table, fkcs \u001B[38;5;129;01min\u001B[39;00m collection:\n\u001B[32m    977\u001B[39m     \u001B[38;5;28;01mif\u001B[39;00m table \u001B[38;5;129;01mis\u001B[39;00m \u001B[38;5;129;01mnot\u001B[39;00m \u001B[38;5;28;01mNone\u001B[39;00m:\n\u001B[32m--> \u001B[39m\u001B[32m978\u001B[39m         \u001B[38;5;28;43mself\u001B[39;49m\u001B[43m.\u001B[49m\u001B[43mtraverse_single\u001B[49m\u001B[43m(\u001B[49m\n\u001B[32m    979\u001B[39m \u001B[43m            \u001B[49m\u001B[43mtable\u001B[49m\u001B[43m,\u001B[49m\n\u001B[32m    980\u001B[39m \u001B[43m            \u001B[49m\u001B[43mcreate_ok\u001B[49m\u001B[43m=\u001B[49m\u001B[38;5;28;43;01mTrue\u001B[39;49;00m\u001B[43m,\u001B[49m\n\u001B[32m    981\u001B[39m \u001B[43m            \u001B[49m\u001B[43minclude_foreign_key_constraints\u001B[49m\u001B[43m=\u001B[49m\u001B[43mfkcs\u001B[49m\u001B[43m,\u001B[49m\n\u001B[32m    982\u001B[39m \u001B[43m            \u001B[49m\u001B[43m_is_metadata_operation\u001B[49m\u001B[43m=\u001B[49m\u001B[38;5;28;43;01mTrue\u001B[39;49;00m\u001B[43m,\u001B[49m\n\u001B[32m    983\u001B[39m \u001B[43m        \u001B[49m\u001B[43m)\u001B[49m\n\u001B[32m    984\u001B[39m     \u001B[38;5;28;01melse\u001B[39;00m:\n\u001B[32m    985\u001B[39m         \u001B[38;5;28;01mfor\u001B[39;00m fkc \u001B[38;5;129;01min\u001B[39;00m fkcs:\n",
      "\u001B[36mFile \u001B[39m\u001B[32m~/cognee/.venv/lib/python3.11/site-packages/sqlalchemy/sql/visitors.py:664\u001B[39m, in \u001B[36mExternalTraversal.traverse_single\u001B[39m\u001B[34m(self, obj, **kw)\u001B[39m\n\u001B[32m    662\u001B[39m meth = \u001B[38;5;28mgetattr\u001B[39m(v, \u001B[33m\"\u001B[39m\u001B[33mvisit_\u001B[39m\u001B[38;5;132;01m%s\u001B[39;00m\u001B[33m\"\u001B[39m % obj.__visit_name__, \u001B[38;5;28;01mNone\u001B[39;00m)\n\u001B[32m    663\u001B[39m \u001B[38;5;28;01mif\u001B[39;00m meth:\n\u001B[32m--> \u001B[39m\u001B[32m664\u001B[39m     \u001B[38;5;28;01mreturn\u001B[39;00m \u001B[43mmeth\u001B[49m\u001B[43m(\u001B[49m\u001B[43mobj\u001B[49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[43m*\u001B[49m\u001B[43m*\u001B[49m\u001B[43mkw\u001B[49m\u001B[43m)\u001B[49m\n",
      "\u001B[36mFile \u001B[39m\u001B[32m~/cognee/.venv/lib/python3.11/site-packages/sqlalchemy/sql/ddl.py:1016\u001B[39m, in \u001B[36mSchemaGenerator.visit_table\u001B[39m\u001B[34m(self, table, create_ok, include_foreign_key_constraints, _is_metadata_operation)\u001B[39m\n\u001B[32m   1007\u001B[39m \u001B[38;5;28;01mif\u001B[39;00m \u001B[38;5;129;01mnot\u001B[39;00m \u001B[38;5;28mself\u001B[39m.dialect.supports_alter:\n\u001B[32m   1008\u001B[39m     \u001B[38;5;66;03m# e.g., don't omit any foreign key constraints\u001B[39;00m\n\u001B[32m   1009\u001B[39m     include_foreign_key_constraints = \u001B[38;5;28;01mNone\u001B[39;00m\n\u001B[32m   1011\u001B[39m \u001B[43mCreateTable\u001B[49m\u001B[43m(\u001B[49m\n\u001B[32m   1012\u001B[39m \u001B[43m    \u001B[49m\u001B[43mtable\u001B[49m\u001B[43m,\u001B[49m\n\u001B[32m   1013\u001B[39m \u001B[43m    \u001B[49m\u001B[43minclude_foreign_key_constraints\u001B[49m\u001B[43m=\u001B[49m\u001B[43m(\u001B[49m\n\u001B[32m   1014\u001B[39m \u001B[43m        \u001B[49m\u001B[43minclude_foreign_key_constraints\u001B[49m\n\u001B[32m   1015\u001B[39m \u001B[43m    \u001B[49m\u001B[43m)\u001B[49m\u001B[43m,\u001B[49m\n\u001B[32m-> \u001B[39m\u001B[32m1016\u001B[39m \u001B[43m\u001B[49m\u001B[43m)\u001B[49m\u001B[43m.\u001B[49m\u001B[43m_invoke_with\u001B[49m\u001B[43m(\u001B[49m\u001B[38;5;28;43mself\u001B[39;49m\u001B[43m.\u001B[49m\u001B[43mconnection\u001B[49m\u001B[43m)\u001B[49m\n\u001B[32m   1018\u001B[39m \u001B[38;5;28;01mif\u001B[39;00m \u001B[38;5;28mhasattr\u001B[39m(table, \u001B[33m\"\u001B[39m\u001B[33mindexes\u001B[39m\u001B[33m\"\u001B[39m):\n\u001B[32m   1019\u001B[39m     \u001B[38;5;28;01mfor\u001B[39;00m index \u001B[38;5;129;01min\u001B[39;00m table.indexes:\n",
      "\u001B[36mFile \u001B[39m\u001B[32m~/cognee/.venv/lib/python3.11/site-packages/sqlalchemy/sql/ddl.py:314\u001B[39m, in \u001B[36mExecutableDDLElement._invoke_with\u001B[39m\u001B[34m(self, bind)\u001B[39m\n\u001B[32m    312\u001B[39m \u001B[38;5;28;01mdef\u001B[39;00m\u001B[38;5;250m \u001B[39m\u001B[34m_invoke_with\u001B[39m(\u001B[38;5;28mself\u001B[39m, bind):\n\u001B[32m    313\u001B[39m     \u001B[38;5;28;01mif\u001B[39;00m \u001B[38;5;28mself\u001B[39m._should_execute(\u001B[38;5;28mself\u001B[39m.target, bind):\n\u001B[32m--> \u001B[39m\u001B[32m314\u001B[39m         \u001B[38;5;28;01mreturn\u001B[39;00m \u001B[43mbind\u001B[49m\u001B[43m.\u001B[49m\u001B[43mexecute\u001B[49m\u001B[43m(\u001B[49m\u001B[38;5;28;43mself\u001B[39;49m\u001B[43m)\u001B[49m\n",
      "\u001B[36mFile \u001B[39m\u001B[32m~/cognee/.venv/lib/python3.11/site-packages/sqlalchemy/engine/base.py:1416\u001B[39m, in \u001B[36mConnection.execute\u001B[39m\u001B[34m(self, statement, parameters, execution_options)\u001B[39m\n\u001B[32m   1414\u001B[39m     \u001B[38;5;28;01mraise\u001B[39;00m exc.ObjectNotExecutableError(statement) \u001B[38;5;28;01mfrom\u001B[39;00m\u001B[38;5;250m \u001B[39m\u001B[34;01merr\u001B[39;00m\n\u001B[32m   1415\u001B[39m \u001B[38;5;28;01melse\u001B[39;00m:\n\u001B[32m-> \u001B[39m\u001B[32m1416\u001B[39m     \u001B[38;5;28;01mreturn\u001B[39;00m \u001B[43mmeth\u001B[49m\u001B[43m(\u001B[49m\n\u001B[32m   1417\u001B[39m \u001B[43m        \u001B[49m\u001B[38;5;28;43mself\u001B[39;49m\u001B[43m,\u001B[49m\n\u001B[32m   1418\u001B[39m \u001B[43m        \u001B[49m\u001B[43mdistilled_parameters\u001B[49m\u001B[43m,\u001B[49m\n\u001B[32m   1419\u001B[39m \u001B[43m        \u001B[49m\u001B[43mexecution_options\u001B[49m\u001B[43m \u001B[49m\u001B[38;5;129;43;01mor\u001B[39;49;00m\u001B[43m \u001B[49m\u001B[43mNO_OPTIONS\u001B[49m\u001B[43m,\u001B[49m\n\u001B[32m   1420\u001B[39m \u001B[43m    \u001B[49m\u001B[43m)\u001B[49m\n",
      "\u001B[36mFile \u001B[39m\u001B[32m~/cognee/.venv/lib/python3.11/site-packages/sqlalchemy/sql/ddl.py:180\u001B[39m, in \u001B[36mExecutableDDLElement._execute_on_connection\u001B[39m\u001B[34m(self, connection, distilled_params, execution_options)\u001B[39m\n\u001B[32m    177\u001B[39m \u001B[38;5;28;01mdef\u001B[39;00m\u001B[38;5;250m \u001B[39m\u001B[34m_execute_on_connection\u001B[39m(\n\u001B[32m    178\u001B[39m     \u001B[38;5;28mself\u001B[39m, connection, distilled_params, execution_options\n\u001B[32m    179\u001B[39m ):\n\u001B[32m--> \u001B[39m\u001B[32m180\u001B[39m     \u001B[38;5;28;01mreturn\u001B[39;00m \u001B[43mconnection\u001B[49m\u001B[43m.\u001B[49m\u001B[43m_execute_ddl\u001B[49m\u001B[43m(\u001B[49m\n\u001B[32m    181\u001B[39m \u001B[43m        \u001B[49m\u001B[38;5;28;43mself\u001B[39;49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[43mdistilled_params\u001B[49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[43mexecution_options\u001B[49m\n\u001B[32m    182\u001B[39m \u001B[43m    \u001B[49m\u001B[43m)\u001B[49m\n",
      "\u001B[36mFile \u001B[39m\u001B[32m~/cognee/.venv/lib/python3.11/site-packages/sqlalchemy/engine/base.py:1527\u001B[39m, in \u001B[36mConnection._execute_ddl\u001B[39m\u001B[34m(self, ddl, distilled_parameters, execution_options)\u001B[39m\n\u001B[32m   1522\u001B[39m dialect = \u001B[38;5;28mself\u001B[39m.dialect\n\u001B[32m   1524\u001B[39m compiled = ddl.compile(\n\u001B[32m   1525\u001B[39m     dialect=dialect, schema_translate_map=schema_translate_map\n\u001B[32m   1526\u001B[39m )\n\u001B[32m-> \u001B[39m\u001B[32m1527\u001B[39m ret = \u001B[38;5;28;43mself\u001B[39;49m\u001B[43m.\u001B[49m\u001B[43m_execute_context\u001B[49m\u001B[43m(\u001B[49m\n\u001B[32m   1528\u001B[39m \u001B[43m    \u001B[49m\u001B[43mdialect\u001B[49m\u001B[43m,\u001B[49m\n\u001B[32m   1529\u001B[39m \u001B[43m    \u001B[49m\u001B[43mdialect\u001B[49m\u001B[43m.\u001B[49m\u001B[43mexecution_ctx_cls\u001B[49m\u001B[43m.\u001B[49m\u001B[43m_init_ddl\u001B[49m\u001B[43m,\u001B[49m\n\u001B[32m   1530\u001B[39m \u001B[43m    \u001B[49m\u001B[43mcompiled\u001B[49m\u001B[43m,\u001B[49m\n\u001B[32m   1531\u001B[39m \u001B[43m    \u001B[49m\u001B[38;5;28;43;01mNone\u001B[39;49;00m\u001B[43m,\u001B[49m\n\u001B[32m   1532\u001B[39m \u001B[43m    \u001B[49m\u001B[43mexec_opts\u001B[49m\u001B[43m,\u001B[49m\n\u001B[32m   1533\u001B[39m \u001B[43m    \u001B[49m\u001B[43mcompiled\u001B[49m\u001B[43m,\u001B[49m\n\u001B[32m   1534\u001B[39m \u001B[43m\u001B[49m\u001B[43m)\u001B[49m\n\u001B[32m   1535\u001B[39m \u001B[38;5;28;01mif\u001B[39;00m \u001B[38;5;28mself\u001B[39m._has_events \u001B[38;5;129;01mor\u001B[39;00m \u001B[38;5;28mself\u001B[39m.engine._has_events:\n\u001B[32m   1536\u001B[39m     \u001B[38;5;28mself\u001B[39m.dispatch.after_execute(\n\u001B[32m   1537\u001B[39m         \u001B[38;5;28mself\u001B[39m,\n\u001B[32m   1538\u001B[39m         ddl,\n\u001B[32m   (...)\u001B[39m\u001B[32m   1542\u001B[39m         ret,\n\u001B[32m   1543\u001B[39m     )\n",
      "\u001B[36mFile \u001B[39m\u001B[32m~/cognee/.venv/lib/python3.11/site-packages/sqlalchemy/engine/base.py:1843\u001B[39m, in \u001B[36mConnection._execute_context\u001B[39m\u001B[34m(self, dialect, constructor, statement, parameters, execution_options, *args, **kw)\u001B[39m\n\u001B[32m   1841\u001B[39m     \u001B[38;5;28;01mreturn\u001B[39;00m \u001B[38;5;28mself\u001B[39m._exec_insertmany_context(dialect, context)\n\u001B[32m   1842\u001B[39m \u001B[38;5;28;01melse\u001B[39;00m:\n\u001B[32m-> \u001B[39m\u001B[32m1843\u001B[39m     \u001B[38;5;28;01mreturn\u001B[39;00m \u001B[38;5;28;43mself\u001B[39;49m\u001B[43m.\u001B[49m\u001B[43m_exec_single_context\u001B[49m\u001B[43m(\u001B[49m\n\u001B[32m   1844\u001B[39m \u001B[43m        \u001B[49m\u001B[43mdialect\u001B[49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[43mcontext\u001B[49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[43mstatement\u001B[49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[43mparameters\u001B[49m\n\u001B[32m   1845\u001B[39m \u001B[43m    \u001B[49m\u001B[43m)\u001B[49m\n",
      "\u001B[36mFile \u001B[39m\u001B[32m~/cognee/.venv/lib/python3.11/site-packages/sqlalchemy/engine/base.py:1983\u001B[39m, in \u001B[36mConnection._exec_single_context\u001B[39m\u001B[34m(self, dialect, context, statement, parameters)\u001B[39m\n\u001B[32m   1980\u001B[39m     result = context._setup_result_proxy()\n\u001B[32m   1982\u001B[39m \u001B[38;5;28;01mexcept\u001B[39;00m \u001B[38;5;167;01mBaseException\u001B[39;00m \u001B[38;5;28;01mas\u001B[39;00m e:\n\u001B[32m-> \u001B[39m\u001B[32m1983\u001B[39m     \u001B[38;5;28;43mself\u001B[39;49m\u001B[43m.\u001B[49m\u001B[43m_handle_dbapi_exception\u001B[49m\u001B[43m(\u001B[49m\n\u001B[32m   1984\u001B[39m \u001B[43m        \u001B[49m\u001B[43me\u001B[49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[43mstr_statement\u001B[49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[43meffective_parameters\u001B[49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[43mcursor\u001B[49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[43mcontext\u001B[49m\n\u001B[32m   1985\u001B[39m \u001B[43m    \u001B[49m\u001B[43m)\u001B[49m\n\u001B[32m   1987\u001B[39m \u001B[38;5;28;01mreturn\u001B[39;00m result\n",
      "\u001B[36mFile \u001B[39m\u001B[32m~/cognee/.venv/lib/python3.11/site-packages/sqlalchemy/engine/base.py:2352\u001B[39m, in \u001B[36mConnection._handle_dbapi_exception\u001B[39m\u001B[34m(self, e, statement, parameters, cursor, context, is_sub_exec)\u001B[39m\n\u001B[32m   2350\u001B[39m \u001B[38;5;28;01melif\u001B[39;00m should_wrap:\n\u001B[32m   2351\u001B[39m     \u001B[38;5;28;01massert\u001B[39;00m sqlalchemy_exception \u001B[38;5;129;01mis\u001B[39;00m \u001B[38;5;129;01mnot\u001B[39;00m \u001B[38;5;28;01mNone\u001B[39;00m\n\u001B[32m-> \u001B[39m\u001B[32m2352\u001B[39m     \u001B[38;5;28;01mraise\u001B[39;00m sqlalchemy_exception.with_traceback(exc_info[\u001B[32m2\u001B[39m]) \u001B[38;5;28;01mfrom\u001B[39;00m\u001B[38;5;250m \u001B[39m\u001B[34;01me\u001B[39;00m\n\u001B[32m   2353\u001B[39m \u001B[38;5;28;01melse\u001B[39;00m:\n\u001B[32m   2354\u001B[39m     \u001B[38;5;28;01massert\u001B[39;00m exc_info[\u001B[32m1\u001B[39m] \u001B[38;5;129;01mis\u001B[39;00m \u001B[38;5;129;01mnot\u001B[39;00m \u001B[38;5;28;01mNone\u001B[39;00m\n",
      "\u001B[36mFile \u001B[39m\u001B[32m~/cognee/.venv/lib/python3.11/site-packages/sqlalchemy/engine/base.py:1964\u001B[39m, in \u001B[36mConnection._exec_single_context\u001B[39m\u001B[34m(self, dialect, context, statement, parameters)\u001B[39m\n\u001B[32m   1962\u001B[39m                 \u001B[38;5;28;01mbreak\u001B[39;00m\n\u001B[32m   1963\u001B[39m     \u001B[38;5;28;01mif\u001B[39;00m \u001B[38;5;129;01mnot\u001B[39;00m evt_handled:\n\u001B[32m-> \u001B[39m\u001B[32m1964\u001B[39m         \u001B[38;5;28;43mself\u001B[39;49m\u001B[43m.\u001B[49m\u001B[43mdialect\u001B[49m\u001B[43m.\u001B[49m\u001B[43mdo_execute\u001B[49m\u001B[43m(\u001B[49m\n\u001B[32m   1965\u001B[39m \u001B[43m            \u001B[49m\u001B[43mcursor\u001B[49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[43mstr_statement\u001B[49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[43meffective_parameters\u001B[49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[43mcontext\u001B[49m\n\u001B[32m   1966\u001B[39m \u001B[43m        \u001B[49m\u001B[43m)\u001B[49m\n\u001B[32m   1968\u001B[39m \u001B[38;5;28;01mif\u001B[39;00m \u001B[38;5;28mself\u001B[39m._has_events \u001B[38;5;129;01mor\u001B[39;00m \u001B[38;5;28mself\u001B[39m.engine._has_events:\n\u001B[32m   1969\u001B[39m     \u001B[38;5;28mself\u001B[39m.dispatch.after_cursor_execute(\n\u001B[32m   1970\u001B[39m         \u001B[38;5;28mself\u001B[39m,\n\u001B[32m   1971\u001B[39m         cursor,\n\u001B[32m   (...)\u001B[39m\u001B[32m   1975\u001B[39m         context.executemany,\n\u001B[32m   1976\u001B[39m     )\n",
      "\u001B[36mFile \u001B[39m\u001B[32m~/cognee/.venv/lib/python3.11/site-packages/sqlalchemy/engine/default.py:942\u001B[39m, in \u001B[36mDefaultDialect.do_execute\u001B[39m\u001B[34m(self, cursor, statement, parameters, context)\u001B[39m\n\u001B[32m    941\u001B[39m \u001B[38;5;28;01mdef\u001B[39;00m\u001B[38;5;250m \u001B[39m\u001B[34mdo_execute\u001B[39m(\u001B[38;5;28mself\u001B[39m, cursor, statement, parameters, context=\u001B[38;5;28;01mNone\u001B[39;00m):\n\u001B[32m--> \u001B[39m\u001B[32m942\u001B[39m     \u001B[43mcursor\u001B[49m\u001B[43m.\u001B[49m\u001B[43mexecute\u001B[49m\u001B[43m(\u001B[49m\u001B[43mstatement\u001B[49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[43mparameters\u001B[49m\u001B[43m)\u001B[49m\n",
      "\u001B[36mFile \u001B[39m\u001B[32m~/cognee/.venv/lib/python3.11/site-packages/sqlalchemy/dialects/sqlite/aiosqlite.py:172\u001B[39m, in \u001B[36mAsyncAdapt_aiosqlite_cursor.execute\u001B[39m\u001B[34m(self, operation, parameters)\u001B[39m\n\u001B[32m    170\u001B[39m         \u001B[38;5;28mself\u001B[39m._cursor = _cursor\n\u001B[32m    171\u001B[39m \u001B[38;5;28;01mexcept\u001B[39;00m \u001B[38;5;167;01mException\u001B[39;00m \u001B[38;5;28;01mas\u001B[39;00m error:\n\u001B[32m--> \u001B[39m\u001B[32m172\u001B[39m     \u001B[38;5;28;43mself\u001B[39;49m\u001B[43m.\u001B[49m\u001B[43m_adapt_connection\u001B[49m\u001B[43m.\u001B[49m\u001B[43m_handle_exception\u001B[49m\u001B[43m(\u001B[49m\u001B[43merror\u001B[49m\u001B[43m)\u001B[49m\n",
      "\u001B[36mFile \u001B[39m\u001B[32m~/cognee/.venv/lib/python3.11/site-packages/sqlalchemy/dialects/sqlite/aiosqlite.py:323\u001B[39m, in \u001B[36mAsyncAdapt_aiosqlite_connection._handle_exception\u001B[39m\u001B[34m(self, error)\u001B[39m\n\u001B[32m    319\u001B[39m     \u001B[38;5;28;01mraise\u001B[39;00m \u001B[38;5;28mself\u001B[39m.dbapi.sqlite.OperationalError(\n\u001B[32m    320\u001B[39m         \u001B[33m\"\u001B[39m\u001B[33mno active connection\u001B[39m\u001B[33m\"\u001B[39m\n\u001B[32m    321\u001B[39m     ) \u001B[38;5;28;01mfrom\u001B[39;00m\u001B[38;5;250m \u001B[39m\u001B[34;01merror\u001B[39;00m\n\u001B[32m    322\u001B[39m \u001B[38;5;28;01melse\u001B[39;00m:\n\u001B[32m--> \u001B[39m\u001B[32m323\u001B[39m     \u001B[38;5;28;01mraise\u001B[39;00m error\n",
      "\u001B[36mFile \u001B[39m\u001B[32m~/cognee/.venv/lib/python3.11/site-packages/sqlalchemy/dialects/sqlite/aiosqlite.py:154\u001B[39m, in \u001B[36mAsyncAdapt_aiosqlite_cursor.execute\u001B[39m\u001B[34m(self, operation, parameters)\u001B[39m\n\u001B[32m    152\u001B[39m     \u001B[38;5;28mself\u001B[39m.await_(_cursor.execute(operation))\n\u001B[32m    153\u001B[39m \u001B[38;5;28;01melse\u001B[39;00m:\n\u001B[32m--> \u001B[39m\u001B[32m154\u001B[39m     \u001B[38;5;28;43mself\u001B[39;49m\u001B[43m.\u001B[49m\u001B[43mawait_\u001B[49m\u001B[43m(\u001B[49m\u001B[43m_cursor\u001B[49m\u001B[43m.\u001B[49m\u001B[43mexecute\u001B[49m\u001B[43m(\u001B[49m\u001B[43moperation\u001B[49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[43mparameters\u001B[49m\u001B[43m)\u001B[49m\u001B[43m)\u001B[49m\n\u001B[32m    156\u001B[39m \u001B[38;5;28;01mif\u001B[39;00m _cursor.description:\n\u001B[32m    157\u001B[39m     \u001B[38;5;28mself\u001B[39m.description = _cursor.description\n",
      "\u001B[36mFile \u001B[39m\u001B[32m~/cognee/.venv/lib/python3.11/site-packages/sqlalchemy/util/_concurrency_py3k.py:132\u001B[39m, in \u001B[36mawait_only\u001B[39m\u001B[34m(awaitable)\u001B[39m\n\u001B[32m    123\u001B[39m     \u001B[38;5;28;01mraise\u001B[39;00m exc.MissingGreenlet(\n\u001B[32m    124\u001B[39m         \u001B[33m\"\u001B[39m\u001B[33mgreenlet_spawn has not been called; can\u001B[39m\u001B[33m'\u001B[39m\u001B[33mt call await_only() \u001B[39m\u001B[33m\"\u001B[39m\n\u001B[32m    125\u001B[39m         \u001B[33m\"\u001B[39m\u001B[33mhere. Was IO attempted in an unexpected place?\u001B[39m\u001B[33m\"\u001B[39m\n\u001B[32m    126\u001B[39m     )\n\u001B[32m    128\u001B[39m \u001B[38;5;66;03m# returns the control to the driver greenlet passing it\u001B[39;00m\n\u001B[32m    129\u001B[39m \u001B[38;5;66;03m# a coroutine to run. Once the awaitable is done, the driver greenlet\u001B[39;00m\n\u001B[32m    130\u001B[39m \u001B[38;5;66;03m# switches back to this greenlet with the result of awaitable that is\u001B[39;00m\n\u001B[32m    131\u001B[39m \u001B[38;5;66;03m# then returned to the caller (or raised as error)\u001B[39;00m\n\u001B[32m--> \u001B[39m\u001B[32m132\u001B[39m \u001B[38;5;28;01mreturn\u001B[39;00m \u001B[43mcurrent\u001B[49m\u001B[43m.\u001B[49m\u001B[43mparent\u001B[49m\u001B[43m.\u001B[49m\u001B[43mswitch\u001B[49m\u001B[43m(\u001B[49m\u001B[43mawaitable\u001B[49m\u001B[43m)\u001B[49m\n",
      "\u001B[36mFile \u001B[39m\u001B[32m~/cognee/.venv/lib/python3.11/site-packages/sqlalchemy/util/_concurrency_py3k.py:196\u001B[39m, in \u001B[36mgreenlet_spawn\u001B[39m\u001B[34m(fn, _require_await, *args, **kwargs)\u001B[39m\n\u001B[32m    192\u001B[39m switch_occurred = \u001B[38;5;28;01mTrue\u001B[39;00m\n\u001B[32m    193\u001B[39m \u001B[38;5;28;01mtry\u001B[39;00m:\n\u001B[32m    194\u001B[39m     \u001B[38;5;66;03m# wait for a coroutine from await_only and then return its\u001B[39;00m\n\u001B[32m    195\u001B[39m     \u001B[38;5;66;03m# result back to it.\u001B[39;00m\n\u001B[32m--> \u001B[39m\u001B[32m196\u001B[39m     value = \u001B[38;5;28;01mawait\u001B[39;00m result\n\u001B[32m    197\u001B[39m \u001B[38;5;28;01mexcept\u001B[39;00m \u001B[38;5;167;01mBaseException\u001B[39;00m:\n\u001B[32m    198\u001B[39m     \u001B[38;5;66;03m# this allows an exception to be raised within\u001B[39;00m\n\u001B[32m    199\u001B[39m     \u001B[38;5;66;03m# the moderated greenlet so that it can continue\u001B[39;00m\n\u001B[32m    200\u001B[39m     \u001B[38;5;66;03m# its expected flow.\u001B[39;00m\n\u001B[32m    201\u001B[39m     result = context.throw(*sys.exc_info())\n",
      "\u001B[36mFile \u001B[39m\u001B[32m~/cognee/.venv/lib/python3.11/site-packages/aiosqlite/cursor.py:48\u001B[39m, in \u001B[36mCursor.execute\u001B[39m\u001B[34m(self, sql, parameters)\u001B[39m\n\u001B[32m     46\u001B[39m \u001B[38;5;28;01mif\u001B[39;00m parameters \u001B[38;5;129;01mis\u001B[39;00m \u001B[38;5;28;01mNone\u001B[39;00m:\n\u001B[32m     47\u001B[39m     parameters = []\n\u001B[32m---> \u001B[39m\u001B[32m48\u001B[39m \u001B[38;5;28;01mawait\u001B[39;00m \u001B[38;5;28mself\u001B[39m._execute(\u001B[38;5;28mself\u001B[39m._cursor.execute, sql, parameters)\n\u001B[32m     49\u001B[39m \u001B[38;5;28;01mreturn\u001B[39;00m \u001B[38;5;28mself\u001B[39m\n",
      "\u001B[36mFile \u001B[39m\u001B[32m~/cognee/.venv/lib/python3.11/site-packages/aiosqlite/cursor.py:40\u001B[39m, in \u001B[36mCursor._execute\u001B[39m\u001B[34m(self, fn, *args, **kwargs)\u001B[39m\n\u001B[32m     38\u001B[39m \u001B[38;5;28;01masync\u001B[39;00m \u001B[38;5;28;01mdef\u001B[39;00m\u001B[38;5;250m \u001B[39m\u001B[34m_execute\u001B[39m(\u001B[38;5;28mself\u001B[39m, fn, *args, **kwargs):\n\u001B[32m     39\u001B[39m \u001B[38;5;250m    \u001B[39m\u001B[33;03m\"\"\"Execute the given function on the shared connection's thread.\"\"\"\u001B[39;00m\n\u001B[32m---> \u001B[39m\u001B[32m40\u001B[39m     \u001B[38;5;28;01mreturn\u001B[39;00m \u001B[38;5;28;01mawait\u001B[39;00m \u001B[38;5;28mself\u001B[39m._conn._execute(fn, *args, **kwargs)\n",
      "\u001B[36mFile \u001B[39m\u001B[32m~/cognee/.venv/lib/python3.11/site-packages/aiosqlite/core.py:132\u001B[39m, in \u001B[36mConnection._execute\u001B[39m\u001B[34m(self, fn, *args, **kwargs)\u001B[39m\n\u001B[32m    128\u001B[39m future = asyncio.get_event_loop().create_future()\n\u001B[32m    130\u001B[39m \u001B[38;5;28mself\u001B[39m._tx.put_nowait((future, function))\n\u001B[32m--> \u001B[39m\u001B[32m132\u001B[39m \u001B[38;5;28;01mreturn\u001B[39;00m \u001B[38;5;28;01mawait\u001B[39;00m future\n",
      "\u001B[36mFile \u001B[39m\u001B[32m~/cognee/.venv/lib/python3.11/site-packages/aiosqlite/core.py:115\u001B[39m, in \u001B[36mConnection.run\u001B[39m\u001B[34m(self)\u001B[39m\n\u001B[32m    113\u001B[39m \u001B[38;5;28;01mtry\u001B[39;00m:\n\u001B[32m    114\u001B[39m     LOG.debug(\u001B[33m\"\u001B[39m\u001B[33mexecuting \u001B[39m\u001B[38;5;132;01m%s\u001B[39;00m\u001B[33m\"\u001B[39m, function)\n\u001B[32m--> \u001B[39m\u001B[32m115\u001B[39m     result = \u001B[43mfunction\u001B[49m\u001B[43m(\u001B[49m\u001B[43m)\u001B[49m\n\u001B[32m    116\u001B[39m     LOG.debug(\u001B[33m\"\u001B[39m\u001B[33moperation \u001B[39m\u001B[38;5;132;01m%s\u001B[39;00m\u001B[33m completed\u001B[39m\u001B[33m\"\u001B[39m, function)\n\u001B[32m    117\u001B[39m     future.get_loop().call_soon_threadsafe(set_result, future, result)\n",
      "\u001B[31mOperationalError\u001B[39m: (sqlite3.OperationalError) database is locked\n[SQL: \nCREATE TABLE data (\n\tid UUID NOT NULL, \n\tname VARCHAR, \n\textension VARCHAR, \n\tmime_type VARCHAR, \n\traw_data_location VARCHAR, \n\towner_id UUID, \n\tcontent_hash VARCHAR, \n\texternal_metadata JSON, \n\tnode_set JSON, \n\ttoken_count INTEGER, \n\tcreated_at DATETIME, \n\tupdated_at DATETIME, \n\tPRIMARY KEY (id)\n)\n\n]\n(Background on this error at: https://sqlalche.me/e/20/e3q8)"
     ]
    }
   ],
   "execution_count": 3
  },
  {
   "cell_type": "markdown",
   "id": "4944567387ec5821",
   "metadata": {},
   "source": [
    "Your data is ready to be queried:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "29b3a1e3279100d2",
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "\u001B[92m20:16:54 - LiteLLM:INFO\u001B[0m: cost_calculator.py:655 - selected model name for cost calculation: openai/text-embedding-3-large\n",
      "\u001B[1mselected model name for cost calculation: openai/text-embedding-3-large\u001B[0m\u001B[92m20:16:55 - LiteLLM:INFO\u001B[0m: cost_calculator.py:655 - selected model name for cost calculation: openai/text-embedding-3-large\n",
      "\u001B[1mselected model name for cost calculation: openai/text-embedding-3-large\u001B[0m\u001B[92m20:16:55 - LiteLLM:INFO\u001B[0m: cost_calculator.py:655 - selected model name for cost calculation: openai/text-embedding-3-large\n",
      "\u001B[1mselected model name for cost calculation: openai/text-embedding-3-large\u001B[0m\u001B[92m20:16:55 - LiteLLM:INFO\u001B[0m: cost_calculator.py:655 - selected model name for cost calculation: openai/text-embedding-3-large\n",
      "\u001B[1mselected model name for cost calculation: openai/text-embedding-3-large\u001B[0m\u001B[92m20:16:55 - LiteLLM:INFO\u001B[0m: cost_calculator.py:655 - selected model name for cost calculation: openai/text-embedding-3-large\n",
      "\u001B[1mselected model name for cost calculation: openai/text-embedding-3-large\u001B[0m\u001B[92m20:16:55 - LiteLLM:INFO\u001B[0m: cost_calculator.py:655 - selected model name for cost calculation: openai/text-embedding-3-large\n",
      "\u001B[1mselected model name for cost calculation: openai/text-embedding-3-large\u001B[0m\u001B[92m20:16:55 - LiteLLM:INFO\u001B[0m: cost_calculator.py:655 - selected model name for cost calculation: openai/text-embedding-3-large\n",
      "\u001B[1mselected model name for cost calculation: openai/text-embedding-3-large\u001B[0m\u001B[92m20:16:55 - LiteLLM:INFO\u001B[0m: cost_calculator.py:655 - selected model name for cost calculation: openai/text-embedding-3-large\n",
      "\u001B[1mselected model name for cost calculation: openai/text-embedding-3-large\u001B[0m\u001B[92m20:16:55 - LiteLLM:INFO\u001B[0m: cost_calculator.py:655 - selected model name for cost calculation: openai/text-embedding-3-large\n",
      "\u001B[1mselected model name for cost calculation: openai/text-embedding-3-large\u001B[0m\u001B[92m20:16:55 - LiteLLM:INFO\u001B[0m: cost_calculator.py:655 - selected model name for cost calculation: openai/text-embedding-3-large\n",
      "\u001B[1mselected model name for cost calculation: openai/text-embedding-3-large\u001B[0m\u001B[92m20:16:55 - LiteLLM:INFO\u001B[0m: cost_calculator.py:655 - selected model name for cost calculation: openai/text-embedding-3-large\n",
      "\u001B[1mselected model name for cost calculation: openai/text-embedding-3-large\u001B[0m\u001B[92m20:16:55 - LiteLLM:INFO\u001B[0m: cost_calculator.py:655 - selected model name for cost calculation: openai/text-embedding-3-large\n",
      "\u001B[1mselected model name for cost calculation: openai/text-embedding-3-large\u001B[0m\u001B[92m20:16:55 - LiteLLM:INFO\u001B[0m: cost_calculator.py:655 - selected model name for cost calculation: openai/text-embedding-3-large\n",
      "\u001B[1mselected model name for cost calculation: openai/text-embedding-3-large\u001B[0m\u001B[92m20:16:55 - LiteLLM:INFO\u001B[0m: cost_calculator.py:655 - selected model name for cost calculation: openai/text-embedding-3-large\n",
      "\u001B[1mselected model name for cost calculation: openai/text-embedding-3-large\u001B[0m\u001B[92m20:16:55 - LiteLLM:INFO\u001B[0m: cost_calculator.py:655 - selected model name for cost calculation: openai/text-embedding-3-large\n",
      "\u001B[1mselected model name for cost calculation: openai/text-embedding-3-large\u001B[0m\u001B[92m20:16:55 - LiteLLM:INFO\u001B[0m: cost_calculator.py:655 - selected model name for cost calculation: openai/text-embedding-3-large\n",
      "\u001B[1mselected model name for cost calculation: openai/text-embedding-3-large\u001B[0m\u001B[92m20:16:55 - LiteLLM:INFO\u001B[0m: cost_calculator.py:655 - selected model name for cost calculation: openai/text-embedding-3-large\n",
      "\u001B[1mselected model name for cost calculation: openai/text-embedding-3-large\u001B[0m\u001B[92m20:16:55 - LiteLLM:INFO\u001B[0m: cost_calculator.py:655 - selected model name for cost calculation: openai/text-embedding-3-large\n",
      "\u001B[1mselected model name for cost calculation: openai/text-embedding-3-large\u001B[0m\u001B[92m20:16:56 - LiteLLM:INFO\u001B[0m: cost_calculator.py:655 - selected model name for cost calculation: openai/text-embedding-3-large\n",
      "\u001B[1mselected model name for cost calculation: openai/text-embedding-3-large\u001B[0m\u001B[92m20:16:56 - LiteLLM:INFO\u001B[0m: cost_calculator.py:655 - selected model name for cost calculation: openai/text-embedding-3-large\n",
      "\u001B[1mselected model name for cost calculation: openai/text-embedding-3-large\u001B[0m\u001B[92m20:16:56 - LiteLLM:INFO\u001B[0m: cost_calculator.py:655 - selected model name for cost calculation: openai/text-embedding-3-large\n",
      "\u001B[1mselected model name for cost calculation: openai/text-embedding-3-large\u001B[0m\u001B[92m20:16:56 - LiteLLM:INFO\u001B[0m: cost_calculator.py:655 - selected model name for cost calculation: openai/text-embedding-3-large\n",
      "\u001B[1mselected model name for cost calculation: openai/text-embedding-3-large\u001B[0m\u001B[92m20:16:56 - LiteLLM:INFO\u001B[0m: cost_calculator.py:655 - selected model name for cost calculation: openai/text-embedding-3-large\n",
      "\u001B[1mselected model name for cost calculation: openai/text-embedding-3-large\u001B[0m\u001B[92m20:16:57 - LiteLLM:INFO\u001B[0m: utils.py:3101 - \n",
      "LiteLLM completion() model= gpt-4o-mini; provider = openai\n",
      "\u001B[1m\n",
      "LiteLLM completion() model= gpt-4o-mini; provider = openai\u001B[0m\u001B[92m20:16:59 - LiteLLM:INFO\u001B[0m: cost_calculator.py:655 - selected model name for cost calculation: openai/gpt-4o-mini-2024-07-18\n",
      "\u001B[1mselected model name for cost calculation: openai/gpt-4o-mini-2024-07-18\u001B[0m\u001B[92m20:16:59 - LiteLLM:INFO\u001B[0m: cost_calculator.py:655 - selected model name for cost calculation: openai/gpt-4o-mini-2024-07-18\n",
      "\u001B[1mselected model name for cost calculation: openai/gpt-4o-mini-2024-07-18\u001B[0m"
     ]
    },
    {
     "data": {
      "text/plain": [
       "['1. Alice  \\n2. The White Rabbit  \\n3. The Cheshire Cat  \\n4. The Hatter (Mad Hatter)  \\n5. The March Hare  \\n6. The Knave of Hearts  \\n7. The Queen of Hearts  \\n8. The King of Hearts  \\n9. The Mock Turtle  \\n10. The Gryphon']"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "await cognee.search(\"List me all the influential characters in Alice in Wonderland.\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "883ce50d2d9dc584",
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "\u001B[92m20:17:00 - LiteLLM:INFO\u001B[0m: cost_calculator.py:655 - selected model name for cost calculation: openai/text-embedding-3-large\n",
      "\u001B[1mselected model name for cost calculation: openai/text-embedding-3-large\u001B[0m\u001B[92m20:17:00 - LiteLLM:INFO\u001B[0m: cost_calculator.py:655 - selected model name for cost calculation: openai/text-embedding-3-large\n",
      "\u001B[1mselected model name for cost calculation: openai/text-embedding-3-large\u001B[0m\u001B[92m20:17:00 - LiteLLM:INFO\u001B[0m: cost_calculator.py:655 - selected model name for cost calculation: openai/text-embedding-3-large\n",
      "\u001B[1mselected model name for cost calculation: openai/text-embedding-3-large\u001B[0m\u001B[92m20:17:00 - LiteLLM:INFO\u001B[0m: cost_calculator.py:655 - selected model name for cost calculation: openai/text-embedding-3-large\n",
      "\u001B[1mselected model name for cost calculation: openai/text-embedding-3-large\u001B[0m\u001B[92m20:17:00 - LiteLLM:INFO\u001B[0m: cost_calculator.py:655 - selected model name for cost calculation: openai/text-embedding-3-large\n",
      "\u001B[1mselected model name for cost calculation: openai/text-embedding-3-large\u001B[0m\u001B[92m20:17:00 - LiteLLM:INFO\u001B[0m: cost_calculator.py:655 - selected model name for cost calculation: openai/text-embedding-3-large\n",
      "\u001B[1mselected model name for cost calculation: openai/text-embedding-3-large\u001B[0m\u001B[92m20:17:00 - LiteLLM:INFO\u001B[0m: cost_calculator.py:655 - selected model name for cost calculation: openai/text-embedding-3-large\n",
      "\u001B[1mselected model name for cost calculation: openai/text-embedding-3-large\u001B[0m\u001B[92m20:17:00 - LiteLLM:INFO\u001B[0m: cost_calculator.py:655 - selected model name for cost calculation: openai/text-embedding-3-large\n",
      "\u001B[1mselected model name for cost calculation: openai/text-embedding-3-large\u001B[0m\u001B[92m20:17:00 - LiteLLM:INFO\u001B[0m: cost_calculator.py:655 - selected model name for cost calculation: openai/text-embedding-3-large\n",
      "\u001B[1mselected model name for cost calculation: openai/text-embedding-3-large\u001B[0m\u001B[92m20:17:00 - LiteLLM:INFO\u001B[0m: cost_calculator.py:655 - selected model name for cost calculation: openai/text-embedding-3-large\n",
      "\u001B[1mselected model name for cost calculation: openai/text-embedding-3-large\u001B[0m\u001B[92m20:17:00 - LiteLLM:INFO\u001B[0m: cost_calculator.py:655 - selected model name for cost calculation: openai/text-embedding-3-large\n",
      "\u001B[1mselected model name for cost calculation: openai/text-embedding-3-large\u001B[0m\u001B[92m20:17:00 - LiteLLM:INFO\u001B[0m: cost_calculator.py:655 - selected model name for cost calculation: openai/text-embedding-3-large\n",
      "\u001B[1mselected model name for cost calculation: openai/text-embedding-3-large\u001B[0m\u001B[92m20:17:00 - LiteLLM:INFO\u001B[0m: cost_calculator.py:655 - selected model name for cost calculation: openai/text-embedding-3-large\n",
      "\u001B[1mselected model name for cost calculation: openai/text-embedding-3-large\u001B[0m\u001B[92m20:17:00 - LiteLLM:INFO\u001B[0m: cost_calculator.py:655 - selected model name for cost calculation: openai/text-embedding-3-large\n",
      "\u001B[1mselected model name for cost calculation: openai/text-embedding-3-large\u001B[0m\u001B[92m20:17:00 - LiteLLM:INFO\u001B[0m: cost_calculator.py:655 - selected model name for cost calculation: openai/text-embedding-3-large\n",
      "\u001B[1mselected model name for cost calculation: openai/text-embedding-3-large\u001B[0m\u001B[92m20:17:01 - LiteLLM:INFO\u001B[0m: cost_calculator.py:655 - selected model name for cost calculation: openai/text-embedding-3-large\n",
      "\u001B[1mselected model name for cost calculation: openai/text-embedding-3-large\u001B[0m\u001B[92m20:17:01 - LiteLLM:INFO\u001B[0m: cost_calculator.py:655 - selected model name for cost calculation: openai/text-embedding-3-large\n",
      "\u001B[1mselected model name for cost calculation: openai/text-embedding-3-large\u001B[0m\u001B[92m20:17:01 - LiteLLM:INFO\u001B[0m: cost_calculator.py:655 - selected model name for cost calculation: openai/text-embedding-3-large\n",
      "\u001B[1mselected model name for cost calculation: openai/text-embedding-3-large\u001B[0m\u001B[92m20:17:01 - LiteLLM:INFO\u001B[0m: cost_calculator.py:655 - selected model name for cost calculation: openai/text-embedding-3-large\n",
      "\u001B[1mselected model name for cost calculation: openai/text-embedding-3-large\u001B[0m\u001B[92m20:17:01 - LiteLLM:INFO\u001B[0m: cost_calculator.py:655 - selected model name for cost calculation: openai/text-embedding-3-large\n",
      "\u001B[1mselected model name for cost calculation: openai/text-embedding-3-large\u001B[0m\u001B[92m20:17:02 - LiteLLM:INFO\u001B[0m: cost_calculator.py:655 - selected model name for cost calculation: openai/text-embedding-3-large\n",
      "\u001B[1mselected model name for cost calculation: openai/text-embedding-3-large\u001B[0m\u001B[92m20:17:03 - LiteLLM:INFO\u001B[0m: cost_calculator.py:655 - selected model name for cost calculation: openai/text-embedding-3-large\n",
      "\u001B[1mselected model name for cost calculation: openai/text-embedding-3-large\u001B[0m\u001B[92m20:17:03 - LiteLLM:INFO\u001B[0m: cost_calculator.py:655 - selected model name for cost calculation: openai/text-embedding-3-large\n",
      "\u001B[1mselected model name for cost calculation: openai/text-embedding-3-large\u001B[0m\u001B[92m20:17:03 - LiteLLM:INFO\u001B[0m: utils.py:3101 - \n",
      "LiteLLM completion() model= gpt-4o-mini; provider = openai\n",
      "\u001B[1m\n",
      "LiteLLM completion() model= gpt-4o-mini; provider = openai\u001B[0m\u001B[92m20:17:05 - LiteLLM:INFO\u001B[0m: cost_calculator.py:655 - selected model name for cost calculation: openai/gpt-4o-mini-2024-07-18\n",
      "\u001B[1mselected model name for cost calculation: openai/gpt-4o-mini-2024-07-18\u001B[0m\u001B[92m20:17:05 - LiteLLM:INFO\u001B[0m: cost_calculator.py:655 - selected model name for cost calculation: openai/gpt-4o-mini-2024-07-18\n",
      "\u001B[1mselected model name for cost calculation: openai/gpt-4o-mini-2024-07-18\u001B[0m"
     ]
    },
    {
     "data": {
      "text/plain": [
       "[\"Alice ended up in Wonderland by following a curious White Rabbit that she encountered while sitting on a riverbank. The Rabbit muttered about being late and carried a watch, piquing Alice's curiosity. She followed it down a rabbit hole, which led her to a fantastical world.\"]"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "await cognee.search(\"How did Alice end up in Wonderland?\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "677e1bc52aa078b6",
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "\u001B[92m20:17:06 - LiteLLM:INFO\u001B[0m: cost_calculator.py:655 - selected model name for cost calculation: openai/text-embedding-3-large\n",
      "\u001B[1mselected model name for cost calculation: openai/text-embedding-3-large\u001B[0m\u001B[92m20:17:06 - LiteLLM:INFO\u001B[0m: cost_calculator.py:655 - selected model name for cost calculation: openai/text-embedding-3-large\n",
      "\u001B[1mselected model name for cost calculation: openai/text-embedding-3-large\u001B[0m\u001B[92m20:17:06 - LiteLLM:INFO\u001B[0m: cost_calculator.py:655 - selected model name for cost calculation: openai/text-embedding-3-large\n",
      "\u001B[1mselected model name for cost calculation: openai/text-embedding-3-large\u001B[0m\u001B[92m20:17:06 - LiteLLM:INFO\u001B[0m: cost_calculator.py:655 - selected model name for cost calculation: openai/text-embedding-3-large\n",
      "\u001B[1mselected model name for cost calculation: openai/text-embedding-3-large\u001B[0m\u001B[92m20:17:06 - LiteLLM:INFO\u001B[0m: cost_calculator.py:655 - selected model name for cost calculation: openai/text-embedding-3-large\n",
      "\u001B[1mselected model name for cost calculation: openai/text-embedding-3-large\u001B[0m\u001B[92m20:17:06 - LiteLLM:INFO\u001B[0m: cost_calculator.py:655 - selected model name for cost calculation: openai/text-embedding-3-large\n",
      "\u001B[1mselected model name for cost calculation: openai/text-embedding-3-large\u001B[0m\u001B[92m20:17:06 - LiteLLM:INFO\u001B[0m: cost_calculator.py:655 - selected model name for cost calculation: openai/text-embedding-3-large\n",
      "\u001B[1mselected model name for cost calculation: openai/text-embedding-3-large\u001B[0m\u001B[92m20:17:06 - LiteLLM:INFO\u001B[0m: cost_calculator.py:655 - selected model name for cost calculation: openai/text-embedding-3-large\n",
      "\u001B[1mselected model name for cost calculation: openai/text-embedding-3-large\u001B[0m\u001B[92m20:17:06 - LiteLLM:INFO\u001B[0m: cost_calculator.py:655 - selected model name for cost calculation: openai/text-embedding-3-large\n",
      "\u001B[1mselected model name for cost calculation: openai/text-embedding-3-large\u001B[0m\u001B[92m20:17:06 - LiteLLM:INFO\u001B[0m: cost_calculator.py:655 - selected model name for cost calculation: openai/text-embedding-3-large\n",
      "\u001B[1mselected model name for cost calculation: openai/text-embedding-3-large\u001B[0m\u001B[92m20:17:06 - LiteLLM:INFO\u001B[0m: cost_calculator.py:655 - selected model name for cost calculation: openai/text-embedding-3-large\n",
      "\u001B[1mselected model name for cost calculation: openai/text-embedding-3-large\u001B[0m\u001B[92m20:17:06 - LiteLLM:INFO\u001B[0m: cost_calculator.py:655 - selected model name for cost calculation: openai/text-embedding-3-large\n",
      "\u001B[1mselected model name for cost calculation: openai/text-embedding-3-large\u001B[0m\u001B[92m20:17:06 - LiteLLM:INFO\u001B[0m: cost_calculator.py:655 - selected model name for cost calculation: openai/text-embedding-3-large\n",
      "\u001B[1mselected model name for cost calculation: openai/text-embedding-3-large\u001B[0m\u001B[92m20:17:06 - LiteLLM:INFO\u001B[0m: cost_calculator.py:655 - selected model name for cost calculation: openai/text-embedding-3-large\n",
      "\u001B[1mselected model name for cost calculation: openai/text-embedding-3-large\u001B[0m\u001B[92m20:17:06 - LiteLLM:INFO\u001B[0m: cost_calculator.py:655 - selected model name for cost calculation: openai/text-embedding-3-large\n",
      "\u001B[1mselected model name for cost calculation: openai/text-embedding-3-large\u001B[0m\u001B[92m20:17:06 - LiteLLM:INFO\u001B[0m: cost_calculator.py:655 - selected model name for cost calculation: openai/text-embedding-3-large\n",
      "\u001B[1mselected model name for cost calculation: openai/text-embedding-3-large\u001B[0m\u001B[92m20:17:06 - LiteLLM:INFO\u001B[0m: cost_calculator.py:655 - selected model name for cost calculation: openai/text-embedding-3-large\n",
      "\u001B[1mselected model name for cost calculation: openai/text-embedding-3-large\u001B[0m\u001B[92m20:17:06 - LiteLLM:INFO\u001B[0m: cost_calculator.py:655 - selected model name for cost calculation: openai/text-embedding-3-large\n",
      "\u001B[1mselected model name for cost calculation: openai/text-embedding-3-large\u001B[0m\u001B[92m20:17:06 - LiteLLM:INFO\u001B[0m: cost_calculator.py:655 - selected model name for cost calculation: openai/text-embedding-3-large\n",
      "\u001B[1mselected model name for cost calculation: openai/text-embedding-3-large\u001B[0m\u001B[92m20:17:06 - LiteLLM:INFO\u001B[0m: cost_calculator.py:655 - selected model name for cost calculation: openai/text-embedding-3-large\n",
      "\u001B[1mselected model name for cost calculation: openai/text-embedding-3-large\u001B[0m\u001B[92m20:17:06 - LiteLLM:INFO\u001B[0m: cost_calculator.py:655 - selected model name for cost calculation: openai/text-embedding-3-large\n",
      "\u001B[1mselected model name for cost calculation: openai/text-embedding-3-large\u001B[0m\u001B[92m20:17:06 - LiteLLM:INFO\u001B[0m: cost_calculator.py:655 - selected model name for cost calculation: openai/text-embedding-3-large\n",
      "\u001B[1mselected model name for cost calculation: openai/text-embedding-3-large\u001B[0m\u001B[92m20:17:07 - LiteLLM:INFO\u001B[0m: cost_calculator.py:655 - selected model name for cost calculation: openai/text-embedding-3-large\n",
      "\u001B[1mselected model name for cost calculation: openai/text-embedding-3-large\u001B[0m\u001B[92m20:17:07 - LiteLLM:INFO\u001B[0m: utils.py:3101 - \n",
      "LiteLLM completion() model= gpt-4o-mini; provider = openai\n",
      "\u001B[1m\n",
      "LiteLLM completion() model= gpt-4o-mini; provider = openai\u001B[0m\u001B[92m20:17:08 - LiteLLM:INFO\u001B[0m: cost_calculator.py:655 - selected model name for cost calculation: openai/gpt-4o-mini-2024-07-18\n",
      "\u001B[1mselected model name for cost calculation: openai/gpt-4o-mini-2024-07-18\u001B[0m\u001B[92m20:17:08 - LiteLLM:INFO\u001B[0m: cost_calculator.py:655 - selected model name for cost calculation: openai/gpt-4o-mini-2024-07-18\n",
      "\u001B[1mselected model name for cost calculation: openai/gpt-4o-mini-2024-07-18\u001B[0m"
     ]
    },
    {
     "data": {
      "text/plain": [
       "['Alice is portrayed as a curious and adventurous girl who explores Wonderland. She often questions her identity and the world around her, showing a blend of innocence and boldness. Alice displays a willingness to engage with bizarre situations and characters, while also being contemplative about her experiences.']"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "await cognee.search(\"Tell me about Alice's personality.\")"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "fd521e182fb66d49",
   "metadata": {},
   "source": [
    "Bonus: See your processed data visualized in a knowledge graph"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "6effdae590b795d3",
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "\n",
      "\u001B[2m2025-06-18T18:17:08.814190\u001B[0m [\u001B[32m\u001B[1minfo     \u001B[0m] \u001B[1mGraph visualization saved as /Users/borisarzentar/graph_visualization.html\u001B[0m [\u001B[0m\u001B[1m\u001B[34mcognee.shared.logging_utils\u001B[0m]\u001B[0m\n",
      "\u001B[2m2025-06-18T18:17:08.814882\u001B[0m [\u001B[32m\u001B[1minfo     \u001B[0m] \u001B[1mThe HTML file has been stored on your home directory! Navigate there with cd ~\u001B[0m [\u001B[0m\u001B[1m\u001B[34mcognee.shared.logging_utils\u001B[0m]\u001B[0m"
     ]
    },
    {
     "data": {
      "text/plain": [
       "'/Users/borisarzentar/graph_visualization.html'"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "True"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import webbrowser\n",
    "import os\n",
    "from cognee.api.v1.visualize.visualize import visualize_graph\n",
    "html = await visualize_graph()\n",
    "home_dir = os.path.expanduser(\"~\")\n",
    "html_file = os.path.join(home_dir, \"graph_visualization.html\")\n",
    "display(html_file)\n",
    "webbrowser.open(f\"file://{html_file}\")"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "f0945d6f1d962ab",
   "metadata": {},
   "source": [
    "For more examples and information on how Cognee GraphRAG works checkout our other more detailed notebooks."
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": ".venv",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.11.5"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
